import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;

import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;


public class HttpInput extends EasyAwarenessInput {

	public void Research() {
		for(Enumeration keys = ConnectionDialerForService.keys();keys.hasMoreElements();){
			boolean asBeenFound = true;
			HttpConnection hc = null;
			InputStream in = null;
			OutputStream out = null;
			String url = (String)keys.nextElement();
			try {
				hc = (HttpConnection)Connector.open(url);
			} catch(ConnectionNotFoundException e){
				asBeenFound = false;
			}catch (IOException e) {
				asBeenFound = false;
				e.printStackTrace();
			} 
			if(asBeenFound){
				ConnectionDialer dial = (ConnectionDialer) ConnectionDialerForService.get(url);
				runConnection runner = new runConnection(dial, hc, url);
				new Thread(runner).start();
			}
		}

	}

	public class runConnection implements Runnable{
		ConnectionDialer dial;
		HttpConnection hc;
		String url;
		public runConnection(ConnectionDialer dial, HttpConnection hc,String url){
			this.dial = dial;
			this.hc = hc;
			this.url = url;
		}

		public void run() {
			Message m;
			m = dial.deal(hc);
			m.setConnectionURL((Object)url);
			m.setSourceType(type);


		}

	}

}
